home *** CD-ROM | disk | FTP | other *** search
-
- /*
- File: LayoutLibrary.h
-
- Contains: layout library interface: Line Layout support routines
-
- Written By: Dave Opstad, Eric Mader
-
- Copyright: ©1992-1995 by Apple Computer, Inc. All rights reserved.
-
- Change History (most recent first):
-
- <1> 1/9/95 JD First checked in.
-
- */
-
- #ifndef __LAYOUTLIBRARY__
- #define __LAYOUTLIBRARY__
-
- #include <GXTypes.h>
- #include <GXGraphics.h>
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- /* for compatibility with old headers */
- #define layoutLibraryIncludes
-
- struct StyleRunOverrides {
- gxPriorityJustificationOverride *priorityJustOverride;
- gxGlyphJustificationOverride *glyphJustOverrides;
- long glyphJustOverridesCount;
- gxGlyphSubstitution *glyphSubstitutions;
- long glyphSubstitutionsCount;
- gxKerningAdjustment *kerningAdjustments;
- long kerningAdjustmentsCount;
- };
- typedef struct StyleRunOverrides StyleRunOverrides;
-
- struct ParagraphRecord {
- short nLayouts;
- Fixed totalHeight;
- gxShape layouts[gxAnyNumber];
- };
- typedef struct ParagraphRecord ParagraphRecord;
- typedef struct ParagraphRecord** ParagraphRecordHandle;
-
- struct RunFeatureTypeName {
- gxRunFeatureType featureType;
- unsigned short nSelectors;
- unsigned short selectorTableOffset;
- short nameIndex;
- };
- typedef struct RunFeatureTypeName RunFeatureTypeName;
-
- struct RunFeatureSelectorName {
- gxRunFeatureSelector featureSelector;
- short nameIndex;
- };
- typedef struct RunFeatureSelectorName RunFeatureSelectorName;
-
- void InitializeRunControls (gxRunControls *runControls);
-
- void InitializeLayoutOptions (gxLayoutOptions *layoutOptions);
-
- void InitializeStyleRunOverrides (StyleRunOverrides *overrides);
-
- void SetDefaultPriorityJustOverride (gxPriorityJustificationOverride *override);
-
- void SetLayoutStyle (
- gxStyle s,
- char *gxFontName,
- Fixed textSize,
- gxTextAttribute attr,
- gxRunControls *runControls,
- gxRunFeature runFeatures[],
- long runFeaturesCount,
- StyleRunOverrides *overrides);
-
- gxStyle NewLayoutStyle (
- char *gxFontName,
- Fixed textSize,
- gxTextAttribute attr,
- gxRunControls *runControls,
- gxRunFeature runFeatures[],
- long runFeaturesCount,
- StyleRunOverrides *overrides);
-
- gxShape NewSingleLayout (
- char *text,
- char *gxFontName,
- Fixed textSize,
- gxLayoutOptions *options,
- gxPoint *position,
- gxTextAttribute attr,
- gxRunControls *runControls,
- gxRunFeature runFeatures[],
- long runFeaturesCount,
- StyleRunOverrides *overrides);
-
- /* The following functions provide a limited paragraph-creation function. They make calls
- to GetWidthArray and do simple gxLine-breaking using the obtained widths.
-
- !!! IMPORTANT NOTE FOLLOWS !!!
-
- These functions need to be able to deal with text in multiple scripts, which might
- contain zero bytes. Therefore calls that determine hard stops (such as NewParagraph)
- do NOT stop at zero bytes; this means that just passing in a single C string is NOT
- sufficient! Callers will need to add a carriage return themselves to the end of the
- text source. */
-
- ParagraphRecordHandle NewParagraph(
- char *text,
- gxStyle baseStyle,
- Fixed width,
- long justified, /* really a boolean; this way for compiler difference reasons */
- Fixed lineHeight, /* if zero, we will deduce */
- gxPoint *firstOrigin); /* origin of first gxLine in paragraph */
-
- ParagraphRecordHandle NewStyledParagraph(
- long textRunCount,
- const void *text[],
- const short textRunLengths[],
- long styleRunCount,
- const gxStyle styles[],
- const short styleRunLengths[],
- long levelRunCount,
- const short levels[],
- const short levelRunLengths[],
- long totalByteCount,
- const gxLayoutOptions *layoutOptions,
- Fixed lineHeight,
- const gxPoint *firstOrigin);
-
- void DisposeParagraph(ParagraphRecordHandle paraRec);
-
- /* GetLayoutBounds can be used to return the bounds of a layout. */
-
- gxShape GetLayoutBounds(gxShape layout);
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif /* __LAYOUTLIBRARY__ */
-